<template>
  <el-row style="height: 100%">
    <el-row style="height: 10%;border-bottom-style: solid;border-bottom-color: #e6e6e6">
      <Header></Header>
    </el-row>
    <el-row style="height: 90%">
      <el-col :span="4" style="height: 100%;">
        <Navigator></Navigator>
      </el-col>
      <el-col :span="20" style="border-top: 1px solid #2c3e50;padding: 0;height: 100%">
        <el-row>
          <h2>用户信息</h2>
        </el-row>
        <el-divider></el-divider>
        <el-row>
          <el-col :span="22" :offset="1">
            <el-row style="margin-bottom: 10px">
              <el-col :span="1">
                <el-button type="primary" @click="queryMember(0)">刷新</el-button>
              </el-col>
            </el-row>
            <el-row>
              <el-table :data="tableData" border width="100%">
                <el-table-column prop="block_height" label="区块高度" width="100"></el-table-column>
                <el-table-column prop="block_time_stamp" label="时间戳" width="190"></el-table-column>
                <el-table-column prop="user_address" label="用户地址" width="350px"></el-table-column>
                <el-table-column prop="company" label="公司" ></el-table-column>
                <el-table-column prop="location" label="地址" ></el-table-column>
                <el-table-column prop="tel" label="电话" ></el-table-column>
                <el-table-column prop="incharge" label="负责人" ></el-table-column>
                <el-table-column prop="main_business" label="主营业务" ></el-table-column>
                <el-table-column prop="business_type" label="业务类型" ></el-table-column>
                <el-table-column prop="tx_hash" label="交易哈希" width="350px"></el-table-column>
              </el-table>
            </el-row>
            <el-pagination background layout="prev,pager,next" :page-size="10"
                           :total=total style="margin-top: 20px" @current-change="handleCurrentChange"></el-pagination>
          </el-col>
        </el-row>


      </el-col>
    </el-row>
  </el-row>

</template>

<script>
import Header from "@/components/Header";
import Navigator from "@/components/Navigator";

export default {
  name: "User",
  components: {
    Header,
    Navigator
  },
  data() {
    return {
      total:0,
      tableData:[]
    }
  },
  mounted() {
    this.queryMember(0)
  },
  methods: {
    queryMember(new_page) {
      this.axios.post('/query_member', {
        input_page: new_page
      }, {
        headers: {
          'content-type':'application/json',
          'token':this.$cookies.get("token")
        }
      }).then((res) => {
        if (res.data.code == 200) {
          this.tableData = res.data.data.list
          this.total = res.data.data.total
          console.log(this.tableData)
        }
      })
    },
    handleCurrentChange(page) {
      this.queryMember(page)
    }
  }
}
</script>

<style scoped>

</style>